package com.paradogs.gs.modules.attr;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author: yumi
 * @date: 2024/10/23  18:05
 * @Description: 最终属性
 */
@Getter
@AllArgsConstructor
@Accessors(fluent = true)
public enum FinalAttrType {

    MAX_HP(1, "最大生命值", (attr) -> attr.getOrDefault(AttrType.HP.id(), 0)),
//    MAX_MP(2),
    ATK(3, "攻击力", (attr) -> attr.getOrDefault(AttrType.ATK.id(), 0)),
//    DEF(4),
//    CD(5),
//    HIT(6),
    ;

    private int id;
    private String desc;
    private Function<Map<Integer, Integer>, Integer> exec;

    private static Map<Integer, FinalAttrType> map = new HashMap<>();
    static {
        for (FinalAttrType type : FinalAttrType.values()) {
            map.put(type.id, type);
        }
    }
    static FinalAttrType get(int id) {
        return map.get(id);
    }


}
